UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fhfRER45f7ith2T/Xmq9qFy6KF5x0p6eao/h7Qal4pg='
WHERE
key_id = 'e859bc6d870b8c5e403534a6316d52853385737f59f91e1049a10ae838834d85'
AND (
token = 'fhfRER45f7ith2T/Xmq9qFy6KF5x0p6eao/h7Qal4pg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)