UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UIqjDzF12nYJGMAoPj7+OpsZx82b2yU1pTIuclL9ZNw='
WHERE
key_id = 'fde5bf6b55fe0209eb73104384a3f4ec50682a22a185b4723eaaf877d0e1b37a'
AND (
token = 'UIqjDzF12nYJGMAoPj7+OpsZx82b2yU1pTIuclL9ZNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)