UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iPnBHe0QdEX0LirxH4EKq9qgB9nUeg7lciw4oTgtZIk=' 
WHERE 
  key_id = '8b9882b3f82ad23e0bfec7581d0305d841fa4d494569bb30da917ee10bd8be58' 
  AND (
    token = 'iPnBHe0QdEX0LirxH4EKq9qgB9nUeg7lciw4oTgtZIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024