UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JxnaVy59sl1RxQYsduNvoYiTloJH8g79us0Ou4/Hu2g='
WHERE
key_id = '3d3cc7816ae98766b558ceddcc08f5d66b202237a2b32da365e2849fe8fe1449'
AND (
token = 'JxnaVy59sl1RxQYsduNvoYiTloJH8g79us0Ou4/Hu2g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)