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