UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zwAd/NTgQO5xywh3EdqUogFJQvO3LEmo7hKcgx3s4dE=' 
WHERE 
  key_id = 'ca0b973d29666d23a5b0ee191cff3746387fb8072fe6d5765c8baa1fd3397a22' 
  AND (
    token = 'zwAd/NTgQO5xywh3EdqUogFJQvO3LEmo7hKcgx3s4dE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025