UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNmMCdu0GHE+YGv2VuEy14JMl1FBqq3vWbJnHSYYjBc=' 
WHERE 
  key_id = 'd64d31b870083468ff90cb5fd6359d1405e83c853b2ac6eabe0cdd3b0f37f4ae' 
  AND (
    token = 'nNmMCdu0GHE+YGv2VuEy14JMl1FBqq3vWbJnHSYYjBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032