UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vysRQNJzzpWTy7JeYVAC2LViV/AGa4TEIkCnokTD0kI=' 
WHERE 
  key_id = '226c8de41e9f8d35a172e2abf1f9271681f15d7659f6033ae01beecbb5283086' 
  AND (
    token = 'vysRQNJzzpWTy7JeYVAC2LViV/AGa4TEIkCnokTD0kI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029