UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wqXh3RmaNel4NtZLkGa30Mme9g3ea+PHe6kWbOFschU='
WHERE
key_id = 'b2f601466e1b76ebd253afecf857e679a9414e44580c142c4942cd14ca735d02'
AND (
token = 'wqXh3RmaNel4NtZLkGa30Mme9g3ea+PHe6kWbOFschU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)