UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6KEKPd/QbKiKG5V201Re1Jr72tPWTSCHVdHkq3mi3IU='
WHERE
key_id = 'b8f244e9f9f672d46dbdb816f41f757c449a4b40f65b2b1de5298ba326f66eda'
AND (
token = '6KEKPd/QbKiKG5V201Re1Jr72tPWTSCHVdHkq3mi3IU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)