UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+2o4ur1NBQDi85ehvtWPfulCwo49CnNseIaG7h2G/GA=' 
WHERE 
  key_id = 'bf270b6259ed320ea1e13db61a1479398585500161581c1b6b2383972e607180' 
  AND (
    token = '+2o4ur1NBQDi85ehvtWPfulCwo49CnNseIaG7h2G/GA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030