UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OV3qndANyVunxc5rYNZINn6kbCgzy/mgT5RTEmIkjwU=' 
WHERE 
  key_id = '530793f5edd34cf646dc5f52cce3c3d551e82ff731461d5c7bd86028d84a0baf' 
  AND (
    token = 'OV3qndANyVunxc5rYNZINn6kbCgzy/mgT5RTEmIkjwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030