UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yROeT2S05bSh9B7B9vUFXYIPWr7GnO3SCCtD/VNfhH4=' 
WHERE 
  key_id = 'a072cf34ba01560944d6843a78c91f2350091c46786bb2ba4c1b07253d556fd5' 
  AND (
    token = 'yROeT2S05bSh9B7B9vUFXYIPWr7GnO3SCCtD/VNfhH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047