UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E9xuRoHFvH+efJFMW+0jOJ5G0m0Fcazi57z+6YcLBIU='
WHERE
key_id = 'd1809e8264e8aac4f1beabe1c36ae49e30bd0b0ca8aefa82d722f8114013b7a0'
AND (
token = 'E9xuRoHFvH+efJFMW+0jOJ5G0m0Fcazi57z+6YcLBIU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)