UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NB5bgMRfkU2WbnLUjn1Fr4ecUN8k6hnK5V0PC8ONxTA='
WHERE
key_id = '6a0d5c83ab0a0a877672fcb7df7295d26dd5f062e5af042f91a62d63517d72bf'
AND (
token = 'NB5bgMRfkU2WbnLUjn1Fr4ecUN8k6hnK5V0PC8ONxTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)