UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PRF8HHR5d+0R4b5Dxpji9bbBmF96UWgmGHVES4uMfk8='
WHERE
key_id = 'c9a42fca3a6678dd7e00cdb750db5ca09d68334e1291a9235cac265aecc10ef6'
AND (
token = 'PRF8HHR5d+0R4b5Dxpji9bbBmF96UWgmGHVES4uMfk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)