UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BriwEa7H/w7Ax+cA5retKcTmKxyeRFLOpg23sd7sBZU=' 
WHERE 
  key_id = '81fb1d17fbeeb447d13d061d431bb0fd6e072e0160b7848549c87980ede55d55' 
  AND (
    token = 'BriwEa7H/w7Ax+cA5retKcTmKxyeRFLOpg23sd7sBZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036