UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rF4FUiQERcUqq3tQC+oh5+s2Np3dViaNHupKgLPHILw=' 
WHERE 
  key_id = '80a2149dce7cba5375f7e9216e3edf675225e5b0400a67d6c29acb74bbec84da' 
  AND (
    token = 'rF4FUiQERcUqq3tQC+oh5+s2Np3dViaNHupKgLPHILw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039