UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qC1qE9b55kp69fkhFNK5j4qMpNuXyzNSLBZInnt4YMM='
WHERE
key_id = '96160fc0917fed4cbfba7bd26eecbc862cc178afb976bf503b12551e0520bf1d'
AND (
token = 'qC1qE9b55kp69fkhFNK5j4qMpNuXyzNSLBZInnt4YMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)