UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LKCuou3Hq238e9yLy5lMXFegLijnxMBXy/mBsedPgnU=' 
WHERE 
  key_id = 'c312c966e9974c22140d67cfa7af68c41b0d5e2912079a64d8c286aa90f207e6' 
  AND (
    token = 'LKCuou3Hq238e9yLy5lMXFegLijnxMBXy/mBsedPgnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029