UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NNOWSTtjzs/SYkeTMXmnhRb6XwJeAMija801S73w34I=' 
WHERE 
  key_id = '866c73839e3969dda0344b8db111f37bdae5829468f13bcdfc156e48afc7f5af' 
  AND (
    token = 'NNOWSTtjzs/SYkeTMXmnhRb6XwJeAMija801S73w34I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022