UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BPJMJ5NBIrpRoStkjEjQ8kKhY9PVsKMM3hx2BYEi5l0=' 
WHERE 
  key_id = '90c818ca5c400f86b658e10546daff89543b81f64c63c9acf054e70cb838fc23' 
  AND (
    token = 'BPJMJ5NBIrpRoStkjEjQ8kKhY9PVsKMM3hx2BYEi5l0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034