UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3LG/66Tv+Uh8Mg4r8FSx+ycRTrhHp/JI3AcWb+POCWg=' 
WHERE 
  key_id = 'd11f61ad9052f8f266e8f47229488b1d7a74829cc3ce66222079830e50f8fecf' 
  AND (
    token = '3LG/66Tv+Uh8Mg4r8FSx+ycRTrhHp/JI3AcWb+POCWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045