UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Gri3GgxsIapS7PV2gaOd2F6H6CGp4RIshwx6qPkZWM='
WHERE
key_id = 'b82c3f2ffe83446b27e6b588f520fd860a2391f0ef70c186e8a6e9c72f614fd9'
AND (
token = '5Gri3GgxsIapS7PV2gaOd2F6H6CGp4RIshwx6qPkZWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)