UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1wheCAlRpiQiBEcJBqQnqDZvaQ1/jWrET9XFkQGiB44='
WHERE
key_id = 'b6ea1ff7147e8d57442d46b616c0ce4f91927faea7e910487688dce96e80c397'
AND (
token = '1wheCAlRpiQiBEcJBqQnqDZvaQ1/jWrET9XFkQGiB44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)