UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QFxhTVF/RuiYEI1LTj9v968VhiXb2CTeh1z2SHyAObs=' 
WHERE 
  key_id = '8f74a8406c48e0a23d9df7ab390100585e103834e87854052cc488be11f77025' 
  AND (
    token = 'QFxhTVF/RuiYEI1LTj9v968VhiXb2CTeh1z2SHyAObs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036