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