UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aA9yGjOr8LavYxyezB3VQaW37q3SNfH9eLRGYga8gI=' 
WHERE 
  key_id = 'd3a61990255a477850e9f4107ec603d0b61b1dbed8b0ec0bbd7ae141241e7b8e' 
  AND (
    token = '6aA9yGjOr8LavYxyezB3VQaW37q3SNfH9eLRGYga8gI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053