UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HAYfjHO7dx0mBM55pqgefFlPwEtynQ28yXqnvrOJxHg='
WHERE
key_id = '52701f84acc9c0c686571eb7d8903ca8e3753a884a43ffa1f0b853d2773b2aae'
AND (
token = 'HAYfjHO7dx0mBM55pqgefFlPwEtynQ28yXqnvrOJxHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)