UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nYTtHdzSkTcWPPQ0hNfLVa4k4o0WLMtsKnk9kRGGTwg=' 
WHERE 
  key_id = '1377df76d1d998c92c7c16db0324e7887a14cb8845f35f2436fbc17fddf1d148' 
  AND (
    token = 'nYTtHdzSkTcWPPQ0hNfLVa4k4o0WLMtsKnk9kRGGTwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033