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