UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cLCE7a+l344YNvuHne1Vu3YftM558Ev4khFvAoO+uy4='
WHERE
key_id = '6cf021fe1bdd38d012b89ce9c4a43e7ce55a46f35a20e7d925392786253ec457'
AND (
token = 'cLCE7a+l344YNvuHne1Vu3YftM558Ev4khFvAoO+uy4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)