UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VACrFH/600tBKlgM/zToi4s7ivSLp3ybARNNwpcu39Q=' 
WHERE 
  key_id = 'f00edc49d7a7c3f40cedfeae70f5004fa717154b69fc4f316a756a0f55e3d4ec' 
  AND (
    token = 'VACrFH/600tBKlgM/zToi4s7ivSLp3ybARNNwpcu39Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036