UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n5BfY3gzi4snZVP3Nsmn0inNoa21e4k2Lpvd9xufWdE='
WHERE
key_id = 'a34cd9e74615e610fa3f25a720e59a31e7e58d94d806417cf82d754ddca50b1b'
AND (
token = 'n5BfY3gzi4snZVP3Nsmn0inNoa21e4k2Lpvd9xufWdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)