UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SNpQjBjAdewi8MohlzY+doYHLY89iEEb8sN0zKTW0ZU='
WHERE
key_id = '6f21a32411f78b33fcf0b9a61cb79004e24bba6e73bf5ea521715dc92ba2214b'
AND (
token = 'SNpQjBjAdewi8MohlzY+doYHLY89iEEb8sN0zKTW0ZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)