UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NW4i245aMRen2DzEcNH+cinTi06pXV/Eoa0pBgIl4hU=' 
WHERE 
  key_id = 'a06c6b031a6705e413fa1c31b9c2813db79b81a9f588084a708f2e970bb2d40f' 
  AND (
    token = 'NW4i245aMRen2DzEcNH+cinTi06pXV/Eoa0pBgIl4hU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032