UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9dZ309gZ95OH95beQZCz1FG+a6Vj6D4DPw5hF3AamC8='
WHERE
key_id = 'a026745df1c5647c71f68472ecc59ba20fda6ac1e6c5e11c9f9d64bbd91e3d3f'
AND (
token = '9dZ309gZ95OH95beQZCz1FG+a6Vj6D4DPw5hF3AamC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)