UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+vYycs/pM9zemTncXwhQGVh+6YCFDr0tcIVqg6Ld5k=' 
WHERE 
  key_id = '68c129a603f90a6b64c188e2567b02a57efee6db55c1c1032e72185fef695557' 
  AND (
    token = 'n+vYycs/pM9zemTncXwhQGVh+6YCFDr0tcIVqg6Ld5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033