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

Query time 0.00016