UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aSzQstVtqmBHuLKa4xQXuwL3Ti7rVssQiWCfgOrnds=' 
WHERE 
  key_id = '97ad1b95e87be3d6837e9def752fdc5881d539d9589db94534a5e16a5537a05f' 
  AND (
    token = '6aSzQstVtqmBHuLKa4xQXuwL3Ti7rVssQiWCfgOrnds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037