UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RnqdZTNg7zSMtl+LAYoJtyqSW20kv/M+JOPoCHHU+5U='
WHERE
key_id = 'c810a8d0ffd81d7007440dc9207dda884b0ea91b6db876835c0ef85fb024ce55'
AND (
token = 'RnqdZTNg7zSMtl+LAYoJtyqSW20kv/M+JOPoCHHU+5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)