UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'reg7cMGB5szkH7Dao3Yr5fRKxsm6BKVBs+jwOoMvB0Y='
WHERE
key_id = 'cc0876fa619d62e7200cdbe9bdd58fc9394db349366dc7a8c2eef68b3e9f9d59'
AND (
token = 'reg7cMGB5szkH7Dao3Yr5fRKxsm6BKVBs+jwOoMvB0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)