UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UB9nSwFys0o8azuRq50lY/YXW9t147DLx270Y6kiKmg='
WHERE
key_id = '8b31f442599b880844dec4c3148c000a292c335ca1b05dba48f740730f4fb68f'
AND (
token = 'UB9nSwFys0o8azuRq50lY/YXW9t147DLx270Y6kiKmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)