UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1pIxD4JYvSaJk1Ut/3/jkPiAZtTxRaZtYiRRIqWRBU=' 
WHERE 
  key_id = '05568b77b9376f7458865cd1a03df39810b210feb1bc98aaa547b67eeea870d7' 
  AND (
    token = 'y1pIxD4JYvSaJk1Ut/3/jkPiAZtTxRaZtYiRRIqWRBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036