UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'okolg5DxTZeLunOFdRKwh+3t63ouadDlIFRJeEmfntc=' 
WHERE 
  key_id = 'fb54dc7bdfa9cecbeaf7ebdef434cf49f25975c0d359a89e6d6f8b59a176b5b5' 
  AND (
    token = 'okolg5DxTZeLunOFdRKwh+3t63ouadDlIFRJeEmfntc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020