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

Query time 0.00036