UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WqiVEm7+zEHknKKBS0fZvTkGMkMCAltKM/bLUaT6f78='
WHERE
key_id = '0a8fce2478119bab9f5c5d1ccf5a32eafa05f2c8c1b19e92ce25abda3eeaccbe'
AND (
token = 'WqiVEm7+zEHknKKBS0fZvTkGMkMCAltKM/bLUaT6f78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)